package com.ganmiao.enums;


import lombok.Getter;

@Getter
public enum PayTypeEnums {

    //支付类型:0现金, 1,支付宝 2.微信 ,3.会员卡支付
    cash_pay(1, "现金支付"),
    zhifb_pay(2, "支付宝支付"),
    wx_pay(3, "微信支付"),
    member_pay(4, "会员卡支付"),
    ;

    private final Integer code;
    private final String desc;

    PayTypeEnums(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // 根据code获取枚举实例
    public static PayTypeEnums getByCode(Integer code) {
        for (PayTypeEnums type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid PayType: code= " + code);
    }
}
